/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidad;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author AcerII
 */
@Entity
@Table(name = "borrado")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Borrado.findAll", query = "SELECT b FROM Borrado b"),
    @NamedQuery(name = "Borrado.findById", query = "SELECT b FROM Borrado b WHERE b.id = :id"),
    @NamedQuery(name = "Borrado.findByDescripcion", query = "SELECT b FROM Borrado b WHERE b.descripcion = :descripcion")})
public class Borrado implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 25)
    @Column(name = "descripcion")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "borradoId")
    private Collection<Transporte> transporteCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "borradoId")
    private Collection<Ciudad> ciudadCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "borradoId")
    private Collection<Pais> paisCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "borradoId")
    private Collection<Usuario> usuarioCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "borradoId")
    private Collection<PedidoDetalle> pedidoDetalleCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "borradoId")
    private Collection<Pedido> pedidoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "borradoId")
    private Collection<Producto> productoCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "borradoId")
    private Collection<Carga> cargaCollection;

    public Borrado() {
    }

    public Borrado(Long id) {
        this.id = id;
    }

    public Borrado(Long id, String descripcion) {
        this.id = id;
        this.descripcion = descripcion;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    @XmlTransient
    public Collection<Transporte> getTransporteCollection() {
        return transporteCollection;
    }

    public void setTransporteCollection(Collection<Transporte> transporteCollection) {
        this.transporteCollection = transporteCollection;
    }

    @XmlTransient
    public Collection<Ciudad> getCiudadCollection() {
        return ciudadCollection;
    }

    public void setCiudadCollection(Collection<Ciudad> ciudadCollection) {
        this.ciudadCollection = ciudadCollection;
    }

    @XmlTransient
    public Collection<Pais> getPaisCollection() {
        return paisCollection;
    }

    public void setPaisCollection(Collection<Pais> paisCollection) {
        this.paisCollection = paisCollection;
    }

    @XmlTransient
    public Collection<Usuario> getUsuarioCollection() {
        return usuarioCollection;
    }

    public void setUsuarioCollection(Collection<Usuario> usuarioCollection) {
        this.usuarioCollection = usuarioCollection;
    }

    @XmlTransient
    public Collection<PedidoDetalle> getPedidoDetalleCollection() {
        return pedidoDetalleCollection;
    }

    public void setPedidoDetalleCollection(Collection<PedidoDetalle> pedidoDetalleCollection) {
        this.pedidoDetalleCollection = pedidoDetalleCollection;
    }

    @XmlTransient
    public Collection<Pedido> getPedidoCollection() {
        return pedidoCollection;
    }

    public void setPedidoCollection(Collection<Pedido> pedidoCollection) {
        this.pedidoCollection = pedidoCollection;
    }

    @XmlTransient
    public Collection<Producto> getProductoCollection() {
        return productoCollection;
    }

    public void setProductoCollection(Collection<Producto> productoCollection) {
        this.productoCollection = productoCollection;
    }

    @XmlTransient
    public Collection<Carga> getCargaCollection() {
        return cargaCollection;
    }

    public void setCargaCollection(Collection<Carga> cargaCollection) {
        this.cargaCollection = cargaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Borrado)) {
            return false;
        }
        Borrado other = (Borrado) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidad.Borrado[ id=" + id + " ]";
    }
    
}
